Skip to content

Add promise support to built-in model RoleMapping#3169

Merged
bajtos merged 1 commit into
strongloop:masterfrom
ebarault:feature/promisify-role-mapping
Feb 1, 2017
Merged

Add promise support to built-in model RoleMapping#3169
bajtos merged 1 commit into
strongloop:masterfrom
ebarault:feature/promisify-role-mapping

Conversation

@ebarault

@ebarault ebarault commented Jan 31, 2017

Copy link
Copy Markdown
Contributor

Description

None of the methods from built-in model RoleMapping currently support promises. this PR adds promise support by using loopback utils helper
In addition no tests exist for RoleMapping model. this PR also add a new set of tests in a dedicated file to cover both callback and promise versions of those methods

Related issues

related issue: #418

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

@slnode

slnode commented Jan 31, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

3 similar comments
@slnode

slnode commented Jan 31, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@slnode

slnode commented Jan 31, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@slnode

slnode commented Jan 31, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

this.roleModel = reg.getModelByType('Role');
this.userModel = reg.getModelByType('User');
this.applicationModel = reg.getModelByType('Application');
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is required as the use of loopback.Role would lead to inconsistent results given the recent introduction of app-local registry

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@ebarault
ebarault force-pushed the feature/promisify-role-mapping branch from 336abd7 to d53f05c Compare January 31, 2017 22:14
@ebarault

Copy link
Copy Markdown
Contributor Author

@superkhau, @bajtos i add more promise support as required by #2971
could you please review?

@bajtos

bajtos commented Feb 1, 2017

Copy link
Copy Markdown
Member

@slnode ok to test

@bajtos bajtos self-assigned this Feb 1, 2017

@bajtos bajtos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nitpicks, I'll address them myself and force-push to your feature branch.

Comment thread test/role-mapping.test.js Outdated

it('supports .user() with a callback', function(done) {
models.RoleMapping.create(
{principalType: 'USER', principalId: oneUser.id}, function(err, mapping) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread test/role-mapping.test.js Outdated

it('supports .childRole() with a callback', function(done) {
models.RoleMapping.create(
{principalType: 'ROLE', principalId: aRole.id}, function(err, mapping) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bajtos
bajtos force-pushed the feature/promisify-role-mapping branch from d53f05c to ceceb44 Compare February 1, 2017 08:51
@bajtos
bajtos merged commit 76dd35e into strongloop:master Feb 1, 2017
@bajtos

bajtos commented Feb 1, 2017

Copy link
Copy Markdown
Member

Landed, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants